package cn.crm.controller;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.crm.Service.IProductService;
import cn.crm.common.ServerResponse;
import cn.crm.entity.Product;

@Controller
@RequestMapping(value="product")
public class ProductController {
	
	@Autowired
	private IProductService productservice;
	
	@RequestMapping(value="toproductpage")
	public String toproductpage() {
		return "product/product_list";
	}
	
	@RequestMapping(value="pageList")
	@ResponseBody
	public ServerResponse pageList(Integer page,Integer limit,Product product){
		return productservice.pageList(page,limit,product);
	}
	
	@RequestMapping(value="toinsertpage")
	public String toinsert(){
		return "product/product_insert";
	}
	
	
	@RequestMapping(value="insert")
	@ResponseBody
	public ServerResponse insert(Product product){
		return productservice.insert(product);
	}
	
	@RequestMapping(value="selectIds")
	@ResponseBody
	public ServerResponse selectIds(){
		return productservice.selectIds();
	}
	
	@RequestMapping(value="exprotExcle")
	public void exprotExcle(HttpServletResponse response){
		productservice.exprotExcle(response);
	}
	

}
